<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://www.springframework.org/security/tags" prefix="sec"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>All agents</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript">
	window.jQuery || document.write('<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery/jquery-2.1.3.js"><\/script>')
</script>
</head>
<body>
<c:if test="${ not empty agents }">
		<table border="2">
			<thead>
				<tr>
					<td>Username</td>
					<td>Edit</td>
					<td>Change password</td>
				</tr>
			</thead>
			<tbody>
				<c:forEach var="currentAgent" items="${ agents }">
					<tr>
						<td><a href="${pageContext.request.contextPath}/agents/view/${ currentAgent.username }">${ currentAgent.username }</a></td>
						<td><a href="${pageContext.request.contextPath}/admins/prepare-edit-agent/${ currentAgent.id }">Edit</a></td>
						<td><a href="${pageContext.request.contextPath}/admins/change-agent-password/${ currentAgent.id }">Change password</a></td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
	</c:if>
	<c:if test="${ empty agents }">
		-- no agents --
	</c:if>
</body>
</html>
